<template>
  <div class="app">
    <Swiper>
      <!-- 对banners进行遍历 -->
      <SwiperItem v-for="item in banners" :key="item.id">
        <a :href="item.link">
          <img :src="item.image" alt="SwiperImage" @load="imageload" />
        </a>
      </SwiperItem>
    </Swiper>
  </div>
</template>

<script>
export default {
  props: {
    banners: {
      type: Array,
    },
  },
  data() {
    return {
      isLoad: false,
    };
  },
  components: {},
  methods: {
    imageload() {
      if (!this.isLoad) {
        this.$emit("swiperImageLoad");
        this.isLoad = true;
      }
    },
  },
};
</script>

<style lang="less" scoped>
.app {
  padding: 0 0;
}
</style>